how to find duplicate words in java